# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=latte-integrale
pkgver=1.7.6
pkgrel=2
pkgdesc='Computer software dedicated to the problems of counting lattice points and integration inside convex polytopes'
arch=(loong64 x86_64)
url='https://www.math.ucdavis.edu/~latte/'
license=(GPL)
depends=(4ti2 ntl cddlib lidia)
source=(https://github.com/latte-int/latte/releases/download/version_${pkgver//./_}/latte-int-$pkgver.tar.gz)
sha256sums=('006c10ebe5d5bfdc9b159cba6264a4432861fe763ce05fe821624ab7d3fc2170')

build() {
  cd latte-int-$pkgver

  export CXXFLAGS+=" -std=c++14" # Fix build with GCC 11
  ./configure --prefix=/usr --enable-shared --with-ntl=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool # Fix overlinking
  make
}

package() {
  cd latte-int-$pkgver
  make DESTDIR="$pkgdir" install

# Fix conflicts with LLVM
  mv "$pkgdir"/usr/bin/{count,latte-count}
}

